package cn.crdeng.controller;

import cn.crdeng.Service.BlogService;
import cn.crdeng.po.Blog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.LinkedHashMap;
import java.util.List;

@Controller
public class archiveShowController {

    @Autowired
    private BlogService blogService;

    @GetMapping("/archive")
    public String archive(Model model) {
        LinkedHashMap<String, List<Blog>> archive = blogService.archive();
        model.addAttribute("archives", archive);
        return "archives";
    }
}
